<form class="form-horizontal" role="form">
    <div class="form-group">
        <div class="input-group">
            <span class="input-group-addon">手机号</span>
            <input type="text" class="form-control" name="phone">
            <span class="input-group-addon send" style="cursor:pointer;background:#727f8c;color:#fff;">点击发送</span>
        </div>
    </div>
    <div class="form-group">
        <div class="input-group">
            <span class="input-group-addon">验证码</span>
            <input type="text" class="form-control" placeholder="请输入验证码" name="code">
        </div>
    </div>
    <div class="form-group">
        <div class="input-group">
            <span class="input-group-addon">新密码</span>
            <input type="password" class="form-control" placeholder="请输入新密码" name="password">
        </div>
    </div>
</form>

<script>
    $(".send").click(send);

    function send() {
        if (!checkMobile($('.form-horizontal [name="phone"]').val())) {
            modals.error("请输入正确的手机号");
            return false;
        }
        AsyncPost("/user/send_code", {phone: $('.form-horizontal [name="phone"]').val()}, function (value) {
            var time = 60;
            var interval = setInterval(function () {
                $(".send").text(time--);
                if (time == 0) {
                    $(".send").text("点击发送");
                    $(".send").click(send);
                    clearInterval(interval);
                } else {
                    $(".send").unbind("click");
                }
            }, 1000);
        });
    }
</script>